﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.CopsBanditsUI {
    import flash.events.*;
    import flash.display.*;
    import org.aswing.*;
    import Classes.sim.*;
    import Display.aswingui.*;

    public class UpgradesPanel extends JPanel {

        public static const PREPARE:String = "prepare";
        public static const UPS_PER_PAGE:int = 4;

        protected var m_upgrades:Array;
        protected var m_bodyPanel:JPanel;
        protected var m_infoPanel:JPanel;
        protected var m_upgradesShelf:UpgradesScrollingList;

        public function UpgradesPanel(){
            super(new SoftBoxLayout(SoftBoxLayout.Y_AXIS, 0, SoftBoxLayout.TOP));
            this.init();
        }
        protected function init():void{
            this.m_upgrades = UpgradeDefinition.getUpgradeChain("mun_policestation");
            while ((this.m_upgrades.length % UPS_PER_PAGE) != 0) {
                this.m_upgrades.push(new UpgradeDefinition(null, null));
            };
            this.makeBackground();
            this.m_bodyPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            this.m_infoPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            this.setPreferredWidth(671);
            this.setPreferredHeight(390);
            this.append(ASwingHelper.verticalStrut(8));
            this.append(this.makeBodyPanel());
            ASwingHelper.prepare(this);
            dispatchEvent(new Event(UpgradesPanel.PREPARE, true));
        }
        protected function makeBackground():void{
            var _local1:DisplayObject = (new (CopsDialog.assetDict["inner_undertab"])() as DisplayObject);
            ASwingHelper.setBackground(this, _local1);
        }
        protected function makeBodyPanel():JPanel{
            this.m_upgradesShelf = new UpgradesScrollingList(this.m_upgrades, UpgradesCellFactory, 0, UPS_PER_PAGE, 1);
            this.m_upgradesShelf.create();
            ASwingHelper.prepare(this.m_upgradesShelf);
            this.m_bodyPanel.append(this.m_upgradesShelf);
            return (this.m_bodyPanel);
        }

    }
}//package Display.CopsBanditsUI 
